<template>
  <div>
    <h2>app</h2>
    <p id="name">name:{{ name }}</p>
    <button @click="changeName">改名</button>
  </div>
</template>

<script setup>
import { ref, nextTick } from "vue";

const name = ref("周某");
const changeName = async () => {
  name.value = "周志超"; //数据更新是异步（内存）
  console.log(document.getElementById("name").innerText);

  await nextTick();
  console.log(document.getElementById("name").innerText);
};
</script>

<style lang="scss" scoped>
</style>